﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <!-- jsp文件头和头部 -->
    <%@ include file="../admin/top.jsp" %>
    <style>
        table tr td img {
            height: 25px;
            border-radius: 8%;
        }
    </style>
</head>
<body>
<div class="container-fluid" id="main-container">
    <div id="page-content" class="clearfix">
        <div class="row-fluid">
            <div class="row-fluid">
                <form action="device/listEntryRecord" method="post" name="userForm" id="userForm">
                    <input type="hidden" name="menuId" value="${page.menuId}">
                    <span style="font-weight: bold; width: 500px; font-size: 18px">设备激活情况(${deviceTotalTime} 更新)</span>
                    <table style="width:70%;">
                        <tr>
                            <td style="width:20%;">
									<span >
										<input style="margin-top: 0px;width:90%;" autocomplete="off" type="text"
                                               name="searchValue" value="${page.searchValue}" placeholder="生产批次"
                                               id="nav-search-input"/>
									</span>
                            </td>
                            <td style="vertical-align:top;width:20%;">
                                <select name="agentUsername" id="agentUsername" data-values="${channels}" data-placeholder="渠道名称(厂商)"
                                        style="vertical-align:top;width: 90%;">
                                    <option value="" style="color: darkgrey">请选择厂商</option>
                                    <c:forEach items="${channels}" var="channel">
                                        <option value=${channel.name} <c:if test="${channel.name eq agentUsername}">selected</c:if> >${channel.name}</option>
                                    </c:forEach>
                                </select>
                            </td>
                            <td style="vertical-align:top;width:20%;">
                                <select name="telecom" data-values="${telecom}" data-placeholder="请选择性别" style="vertical-align:top;width: 90%;">
                                    <option value="">电信版</option>
                                    <option value="1"
                                            <c:if test="${telecom == 1}">selected</c:if> >是
                                    </option>
                                    <option value="0"
                                            <c:if test="${telecom == 0}">selected</c:if> >否
                                    </option>
                                </select>
                            </td>
                            <td style="width:24%">
									<span>
										<input class="span10 date-picker" name="startTime" id="startTime"
                                               value="${startTime}" type="text" data-date-format="yyyy-mm-dd"
                                               readonly="readonly"
                                               style="width:48%;display: table-cell;font-size: 12px;float: left"
                                               placeholder="开始日期" title="开始日期"/>
										<input class="span10 date-picker" name="endTime" id="endTime" value="${endTime}"
                                               type="text" data-date-format="yyyy-mm-dd" readonly="readonly"
                                               style="width:48%;display: table-cell;font-size: 12px;float:left;"
                                               placeholder="结束日期" title="结束日期"/>
									</span>
                            </td>
                            <td style="vertical-align:top;width:20%;">
                                <select id="isQueryStatistic" name="isQueryStatistic" data-values="${isQueryStatistic}" data-placeholder="请选择是否统计" style="vertical-align:top;width: 90%;">
                                    <option value="">是否统计</option>
                                    <option value="1"
                                            <c:if test="${isQueryStatistic == 1}">selected</c:if> >是
                                    </option>
                                    <option value="0"
                                            <c:if test="${isQueryStatistic == 0}">selected</c:if> >否
                                    </option>
                                </select>
                            </td>
                            <td style="vertical-align:top;width:10%">
                                <button class="btn btn-mini btn-light" type="button" onclick="search();" title="检索">
                                    <i id="nav-search-icon" class="icon-search"></i>
                                </button>
                            </td>
                        </tr>
                    </table>
                    <table style="width:80%;">
                        <tr>
                            <td style="width:15%;">
									<span>
										录入设备总数：<c:out value="${entryRecordStatisticsResp.importTotal}"/>
									</span>
                            </td>
                            <td style="width:15%;">
									<span>
										激活设备总数：<c:out value="${entryRecordStatisticsResp.activeTotal}"/>
									</span>
                            </td>
                            <td style="width:15%;">
									<span>
										绑定设备总数：<c:out value="${entryRecordStatisticsResp.bindTotal}"/>
									</span>
                            </td>
                            <td style="width:15%;">
									<span>
										激活总比例：
                                        <c:choose>
                                            <c:when test="${empty entryRecordStatisticsResp or entryRecordStatisticsResp.activeTotalRadio == '0.00'}">0</c:when>
                                            <c:otherwise>${entryRecordStatisticsResp.activeTotalRadio}%</c:otherwise>
                                        </c:choose>
									</span>
                            </td>
                            <td style="width:15%;">
									<span>
										绑定总比例：
                                        <c:choose>
                                            <c:when test="${empty entryRecordStatisticsResp or entryRecordStatisticsResp.bindTotalRadio == '0.00'}">0</c:when>
                                            <c:otherwise>${entryRecordStatisticsResp.bindTotalRadio}%</c:otherwise>
                                        </c:choose>
									</span>
                            </td>
                            <td style="width:15%;">
									<span>
										绑定占激活的总比例：
                                        <c:choose>
                                            <c:when test="${empty entryRecordStatisticsResp or entryRecordStatisticsResp.bindActiveTotalRadio == '0.00'}">0</c:when>
                                            <c:otherwise>${entryRecordStatisticsResp.bindActiveTotalRadio}%</c:otherwise>
                                        </c:choose>
									</span>
                            </td>
                        </tr>
                    </table>
                    <!-- 检索  -->
                    <table id="table_report" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>生产批次</th>
                            <th>渠道商</th>
                            <th>已录入设备数量(台)</th>
                            <th>激活设备数量(台)</th>
                            <th>已绑定设备数量(台)</th>
                            <th>激活比例</th>
                            <th>绑定比例</th>
                            <th>电信版</th>
                            <th>导入时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <!-- 开始循环 -->
                        <c:choose>
                            <c:when test="${not empty enteryRecords}">
                                <c:forEach items="${enteryRecords}" var="ir">
                                    <tr style="text-align: center">
                                        <td>${ir.id}</td>
                                        <td>${ir.agentUsername }</td>
                                        <td>${ir.importNum }</td>
                                        <td>${ir.activeNum }</td>
                                        <td>${ir.bindNum }</td>
                                        <td>
                                            <c:choose>
                                                <c:when test="${empty ir.activeRadio or ir.activeRadio == '0.00'}">0</c:when>
                                                <c:otherwise>${ir.activeRadio}%</c:otherwise>
                                            </c:choose>
                                        </td>
                                        <td>
                                            <c:choose>
                                                <c:when test="${empty ir.bindRadio or ir.bindRadio =='0.00'}">0</c:when>
                                                <c:otherwise>${ir.bindRadio}%</c:otherwise>
                                            </c:choose>
                                        </td>
                                        <td>
                                            <c:choose>
                                                <c:when test="${ir.telecom == 1}">是</c:when>
                                                <c:otherwise>否</c:otherwise>
                                            </c:choose>
                                        </td>
                                        <td><fmt:formatDate value="${ir.importTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                    </tr>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <tr class="main_info">
                                    <td colspan="9" class="center">没有相关数据</td>
                                </tr>
                            </c:otherwise>
                        </c:choose>
                        </tbody>
                    </table>
                    <div class="page-header position-relative">
                        <table style="width:100%;">
                            <tr>
                                <td style="vertical-align:top;">
                                    <div class="pagination"
                                         style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 返回顶部  -->
<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
    <i class="icon-double-angle-up icon-only"></i>
</a>
<!-- 引入 -->
<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/ace-elements.min.js"></script>
<script src="static/js/ace.min.js"></script>

<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
<script type="text/javascript" src="static/js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
<script type="text/javascript" src="static/js/bootbox.min.js"></script><!-- 确认窗口 -->
<!-- 引入 -->
<script type="text/javascript" src="static/js/jquery.tips.js"></script><!--提示框-->
<script type="text/javascript">
    $(function () {
        top.hangge();
        //日期框
        $('.date-picker').datepicker({autoclose: true});
        //下拉框
        $(".chzn-select").chosen({disable_search: true});
        $(".chzn-select-deselect").chosen({allow_single_deselect: true});
        //复选框
        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });
        });
    });

    //检索
    function search() {
        var start = $('#startTime').val();
        var end = $('#endTime').val();
        if (end != "" && start != "") {
            if (new Date(start).getTime() > new Date(end).getTime()) {
                $("#endTime").tips({
                    side: 3,
                    msg: '结束时间不能小于开始时间',
                    bg: '#AE81FF',
                    time: 2
                });
                $("#endTime").focus();
                return false;
            }
        }
        top.jzts();
        $("#userForm").submit();
    }
</script>
</body>
</html>
